<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="http://localhost:8080/CSS/login.css"/>
</head>
<body>
<div class="body_div">
    <div class="body_bor">
        <h2 style="color: white; text-align: center; line-height: 30px;">更改登录密码</h2>
        <form action="/chenck" method="post" enctype="application/x-www-form-urlencoded">
            <p>
                <label>原密码：</label>
                <input type="password" placeholder="请输入原密码" name="pwd" id="pwd" />
                <img src="http://localhost:8080/images/close.png" alt="" id="eye" class="img">
            </p>
            <p>
                <label>新密码：</label>
                <input type="password" placeholder="请输入新密码" name="p" id="p" />
                <img src="http://localhost:8080/images/close.png" alt="" id="eyes" class="img">
            </p>
            <p>
                <label>新密码：</label>
                <input type="password" placeholder="请确认新密码" name="pw" id="pw" />
                <img src="http://localhost:8080/images/close.png" alt="" id="ey" class="img">
            </p>
            <p>
                <input type="submit" value="确定更改" class="btn" id="sub" />
            </p>
        </form>
    </div>
</div>
</body>
</html>
<script type="text/javascript">
    var sub = document.getElementById('sub');
    var check = document.getElementById('check');

    //1.获取元素
    var eye = document.getElementById('eye');
    var eyes = document.getElementById('eyes');
    var ey = document.getElementById('ey');
    var pwd = document.getElementById('pwd');
    var p = document.getElementById('p');
    var pw = document.getElementById('pw');

    //2.注册事件    处理程序
    var flag = 0;
    var flags = 0;
    var fla = 0;
    eye.onclick = function() {
        //点击一次，flag一定变化
        if (flag == 0) {
            pwd.type = 'text';
            eye.src = 'http://localhost:8080/images/open.png';
            flag = 1; //赋值操作
        } else {
            pwd.type = 'password';
            eye.src = 'http://localhost:8080/images/close.png';
            flag = 0;
        }

    }

    eyes.onclick = function() {
        //点击一次，flag一定变化
        if (flags == 0) {
            p.type = 'text';
            eyes.src = 'http://localhost:8080/images/open.png';
            flags = 1; //赋值操作
        } else {
            p.type = 'password';
            eyes.src = 'http://localhost:8080/images/close.png';
            flags = 0;
        }

    }


    ey.onclick = function() {
        //点击一次，flag一定变化
        if (fla == 0) {
            pw.type = 'text';
            ey.src = 'http://localhost:8080/images/open.png';
            fla = 1; //赋值操作
        } else {
            pw.type = 'password';
            ey.src = 'http://localhost:8080/images/close.png';
            fla = 0;
        }

    }

</script>

